package com.wugenqiang.common.enums;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * Created by wjl on 19/06/2017. ErrorCode,按照数据段来定义
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ErrorCode {

    /**
     * 非法请求
     */
    BAD_REQUEST (404, "非法请求"),

    /**
     * 200x成功和部分成功
     **/
    OK_ERROR(200, "请求成功"),

    /**
     * 700x用户相关错误
     **/
    USER_PWD_WRONG(7001, "用户名密码错误"), USER_HAS_EXIST(7002, "用户名已存在"), USER_IS_NOT(7003, "用户不存在"),
    USER_FORBIDDEN(7404, "用户无权限"),
    USER_NOT_HAS_INFO(7405, "用户信息不完整"),
    /**
     * 800x服务器错误
     **/
    SERVER_ERROR_COMM(8000, "服务忙"), PARAMETER_ERROR(8001, "参数传入错误"),

    /**
     * 1000x文件错误
     **/
    ADD_FILE_ERROR(10000, "文件上传错误"),
    /**
     * 1100x邀请码错误
     **/
    INVITE_CODE_ERROR(11000, "当前邀请码不存在"), INVITE_CODE_HAS_MORE(11001, "邀请码已存在"),


    /**
     * 自定义
     */
    ARTICLE_NOT_HAVE_TYPE(13001, "请补全个人信息，才能发表文章");

    ErrorCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    private Integer code;

    private String message;

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
